<?php
namespace app\app\controller;

use app\common\controller\App;
use think\Db;
use think\Exception;


class Sign extends App
{
    protected $middleware = ['AppAuth'];


    //签到
     public function sign()
     {
         $addres=request()->param("address");
         $date=date("Ymd",time());
         $uid=$this->getLoginUid();

         $is_sign=Db::name("Sign")->where(['uid'=>$uid,'date'=>$date])->find();
         if (!empty($is_sign)){
             return $this->fail('您今日已签到');
         }
         $res=Db::name("Sign")->insert(['uid'=>$uid,'date'=>$date,'title'=>'签到','address'=>$addres]);
         if ($res){
             return $this->ok('签到成功');
         }else{
             return $this->fail('签到失败');
         }


     }



}
